﻿using habbo.Habbo.Characters;
using habbo.Habbo.Messenger;
using habbo.Kernel.Network;
using habbo.Kernel.Packets.Messages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace habbo.Kernel.Packets.com.sulake.habbo.communication.messages.outgoing.messenger
{
    class FriendListUpdateComposer : ServerPacket
    {
        public FriendListUpdateComposer(Session Session, Dictionary<int,int> UpdateRequests) : base(0)
        {
            UpdateRequests.Add(2, (int) MessengerUpdateType.EnterOrLeave);
            base.Append(0);
            Console.WriteLine("[COUNT][FRNDCOUNT][#" + UpdateRequests.Count + "]");
            base.Append(UpdateRequests.Count);

            foreach (var kvp in UpdateRequests)
            {
                Console.WriteLine(UpdateRequests.Count);

                CharacterStatus Status = SystemApp.HabboSystem.CharacterManager.GetStatus(kvp.Key);

                base.Append(kvp.Value);
                base.Append(SystemApp.HabboSystem.CharacterManager.GetUsername(kvp.Key));
                base.Append(1);
                base.Append(Status == CharacterStatus.Online);
                base.Append(false);
                base.Append(Status == CharacterStatus.Online ? SystemApp.HabboSystem.CharacterManager.GetFigure(kvp.Key) : string.Empty);
                base.Append(0);//group
                base.Append(Status == CharacterStatus.Offline ? SystemApp.HabboSystem.CharacterManager.GetMotto(kvp.Key) : string.Empty);
                base.Append(Status == CharacterStatus.Online ? SystemApp.HabboSystem.CharacterManager.GetRealName(kvp.Key) : string.Empty);
                base.Append("22-07-2012");
                base.Append(false);
                base.Append(false);
            }
        }
    }
}
